$(function(){
	$('#createdate').datebox({
    	formatter:function(date){
    		var y = date.getFullYear();
    		var m = date.getMonth()+1;
    		var d = date.getDate();
    		return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
    	},
    	parser:function(s){
    		if (!s) return new Date();
    		var ss = (s.split('-'));
    		var y = parseInt(ss[0],10);
    		var m = parseInt(ss[1],10);
    		var d = parseInt(ss[2],10);
    		if (!isNaN(y) && !isNaN(m) && !isNaN(d)){
    			return new Date(y,m-1,d);
    		} else {
    			return new Date();
    		}
    	}
    });
	$('#doSave').click(function(){
		$('#saveForm').form('submit',{
			url:qxgl.paserUrl('user/saveUserform'),
			success:function(err){
				if(err){
					$.messager.alert('','保存失败!','error');
				}else{
					$.messager.alert('','保存成功!','info');
					parent.$('#msgwindow').window('close');
				}
			}
		});
	});
	$('#doCancel').click(function(){
		parent.$('#msgwindow').window('close');
	});
});